package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.entity.entity.HelloWorldEntity;
import com.example.demo.entity.mapper.HelloWorldMapper;
import com.example.demo.entity.wrapper.HelloWorldQuery;

import cn.org.atool.fluent.mybatis.model.StdPagedList;

@RestController
public class DemoController {

    @Autowired
    private HelloWorldMapper maper;

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/list")
    public StdPagedList<HelloWorldEntity> list() {
    	
    	HelloWorldEntity entity = new HelloWorldEntity();
    	entity.setYourName("xiaomi");
    	
    	maper.insert(entity);
    	
    	HelloWorldQuery query = new HelloWorldQuery().orderBy.id().asc().end().limit(0, 10);
        StdPagedList<HelloWorldEntity> list = maper.stdPagedEntity(query);

        return list;
    }
}
